Skip to content

Add a way to set auth provider on rancher2_custom_user_token#2108

Open
disaster37 wants to merge 4 commits into
rancher:mainfrom
disaster37:fix/issue-2102
Open

Add a way to set auth provider on rancher2_custom_user_token#2108
disaster37 wants to merge 4 commits into
rancher:mainfrom
disaster37:fix/issue-2102

Conversation

@disaster37
Copy link
Copy Markdown

Addresses #2102

Description

Add field auth_provider on resource rancher2_custom_user_token to generate token for ActiveDirectory user or others. If not set, default is local.
I change DoUserLogin function to use v3 API first, instead to continue to use v1. On my Rancher (2.13.1), the v1 api is still here, so it never use the new v3 API. It seems the v3 api support more auth provider like ping or custom_oidc.

Testing

I have compiled the binaire and put it on ~/.terraform.d/plugins/terraform.local/local/rancher2/0.1.1/linux_amd64/terraform-provider-rancher2.
You need to have Rancher with ActiveDirectory Auth provider setted (or other)

Then:

provider "rancher2" {
  api_url    = "https://rancher.local.domain"
  insecure   = true
  token_key      = "xxx"
}

resource "rancher2_custom_user_token" "test_ad" {
  auth_provider = "activedirectory"
  username = "user1"
  password = "xxx"
  description = "foo token"
  ttl = 0
}

To finish:

terraform apply

Not a breaking change.

@matttrach
Copy link
Copy Markdown
Collaborator

matttrach commented Mar 16, 2026

This is reverting #1997. While the name is misleading, the v3 API is older. The v1 API is the first version of a new API, while the v3 is the third version of the older API.

@matttrach matttrach added the area/authentication This appears to be related to authentication. label Mar 16, 2026
@matttrach
Copy link
Copy Markdown
Collaborator

Since it reverts a change for the latest release I don't think it can be accepted as is.

@matttrach matttrach requested a review from pmatseykanets March 16, 2026 18:44
@disaster37
Copy link
Copy Markdown
Author

Ok, I have go back to use v1 api first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/authentication This appears to be related to authentication.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants